home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
prog_c
/
cuj0696.zip
/
DWYER.ZIP
/
SERIAL.TST
/
SERLCOD.TXT
< prev
next >
Wrap
Text File
|
1996-02-13
|
2KB
|
44 lines
Algorithm S (Serial Test)
This algorithm calculates Kolmogorov-Smirnov statistics and
probabilities for sets of successive independent random pairs.
The upper range (R) of the data set is specified by the user.
First, 100 chi-square probabilities are calculated and stored.
These probabilities are used to calculate Kolmogorov-Smirnov
statistics and probabilities which are printed.
Inputs:
C = Number of Categories (= S^2)
P = Number of Pairs of Variates
S = Number of Entries in Data Set
U() = Uniform Random Number Generator Function Under Test
S1. [Initialize.] Set k <- 0, m <- 0, F <- C - 1.
S2. [Generate Data for KS test.] Execute Steps S3 to S7 100 times,
then go on to S8.
S3. [Calculate next chi-square statistic.] Set SoS <- 0, t <- 0,
m <- 0, and set Occurs[j] <- 0, 1 <= j <= C. (We will execute
step S4 P times. Steps S5 and S6 complete the calculation.)
S4. [Tally Next Observation.] Set x <- U() mod S, y <- U() mod S,
and v = x * S + y. Set Occurs[v] <- Occurs[v] + 1. Increase t.
If t < P, repeat this step.
S5. [Calculate sum of squares.] Set SoS <= SoS + Occurs[m]^2, and
m <- m + 1. If m < C, repeat this step.
S6. [Finish chi-square statistic.] Set XSQ <- (C/P) * SoS - P.
S7. [Calculate p-value.] Execute function chdtr() to get p-value.
Set k <- k + 1. Then, set ProbXSQ[k] <- chdtr(F, XSQ). If k < 100,
return to step S3.
S8. [Calculate K-S data.] Execute function KSCalc() to get K-S
statistics and probabilities. There will be four quantities
produced - Kn+, Pn+, Kn-, Pn-.
S9. [Print Results.] Print Kn+, Pn+, Kn-, Pn-.